package com.gist.cithub.service.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.gist.cithub.service.entity.AverageScoreEntity;
import com.gist.cithub.service.service.AverageScoreService;
import com.gist.common.utils.PageUtils;
import com.gist.common.utils.R;



/**
 * 服务平均得分
 *
 * @author lejin
 * @email sunlightcs@gmail.com
 * @date 2020-11-23 13:29:16
 */
@RestController
@RequestMapping("service/averagescore")
public class AverageScoreController {
    @Autowired
    private AverageScoreService averageScoreService;
    /**
     * 根据服务id获取分数
     */
    @RequestMapping("/getScoreByServiceId/{serviceId}")
    public R getScoreByServiceId(@PathVariable("serviceId") Integer serviceId){
        AverageScoreEntity averageScore = averageScoreService.getScoreByServiceId(serviceId);
        return R.ok().put("scores", averageScore.getScores()).put("peopleNum",averageScore.getMembers());
    }

}
